package vvlog

import (
	"github.com/sirupsen/logrus"
	"os"
)

// Create a new instance of the logger. You can have any number of instances.
var (
	level      = logrus.DebugLevel
	MainLogger = logrus.New()
)

func init() {
	MainLogger.Out = os.Stdout
	MainLogger.SetLevel(level)
}

func RootLevel(logLevel string) {
	vlevel, err := logrus.ParseLevel(logLevel)
	if err == nil {
		level = vlevel
	}
}

func NewLogger(fileName string) *logrus.Entry {
	return MainLogger.WithField("file", fileName)
}

func test() {
	logger := NewLogger("vvlog.go")
	logger.Debug("here is log")
}
